package com.xhs.controller;


import com.xhs.bo.SmsBo;
import com.xhs.manager.intf.AliSmsService;
import com.xhs.vo.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/sms")
@CrossOrigin//实现跨域
@Api(value = "验证码",tags = "验证码")
public class AliSmsController {

    @Autowired
    private AliSmsService service;

    @ApiOperation(value = "发送注册验证码",notes = "发送注册验证码")
    @GetMapping("sendRcode")
    public R sendR(String phone){
        return service.sendRCode(phone);
    }

    @ApiOperation(value = "校验注册验证码",notes = "校验注册验证码")
    @PostMapping("checkcode")
    public R checkR(@RequestBody SmsBo smsBo){
        return service.checkRCode(smsBo);
    }

    @ApiOperation(value = "发送登录验证码",notes = "发送登录验证码")
    @GetMapping("sendLcode")
    public R sendL(String phone){
        return service.sendLCode(phone);
    }

    @ApiOperation(value = "发送找回验证码",notes = "发送找回验证码")
    @GetMapping("sendFcode")
    public R sendF(String phone){
        return service.sendFCode(phone);
    }

}
